      double precision Function EOS(x,key)
      !*****************************************************************
      include 'accur.for'
      Common /gamma/gamma,CN,CK;
!       parameter(CN=one/(gamma-one),CK=one/(one+CN))
!       parameter(gamma=2d0)
!       parameter(gamma=5d0/3d0)
c      parameter(gamma=4d0/3d0)
c      parameter(gamma=1.3d0)
c      parameter(gamma=1.275d0)
c      parameter(gamma=1.25d0)
      if(key.eq.1) then ! rho(H)
          if(x.gt.zero) then
              EOS=(x/((one+CN)*CK))**CN
c actually for CK=one/(one+CN) we have here rho=H**CN
          else
              EOS=zero
          endif
      endif
      if(key.eq.2) then ! drho_dH(H)
          if(x.gt.zero) then
              EOS=CN*x**(CN-one)/((one+CN)*CK)**CN
          else
              EOS=zero
          endif
      endif
      if(key.eq.3) then ! H(rho)
          if(x.gt.zero) then
              EOS=(one+CN)*CK*x**(one/CN)
          else
              EOS=zero
          endif
      endif
      if(key.eq.4) then ! p(H)
          if(x.gt.zero) then
              EOS=CK*(x/((one+CN)*CK))**(one+CN)
          else
              EOS=zero
          endif
      endif
      if(key.eq.5) then ! -- here E*rho: EV(rho)
          if(x.gt.zero) then
              EOS=CN*CK*x**(one+one/CN)
          else
              EOS=zero
          endif
      endif
      return
      end
